  // THIS FILE MOVES THE SNAKE, DOES THE HITDETECTION, RENDERS NEW FOOD
 
#include "GLOBALS.h"
 
  // Structure to hold a bodypieces coordinates (of the snake)
  struct BodyPart{
    int cordX; // Coordinates of a body part.
    int cordY;
    int food=0; // food in the belly? 1 for yes
  };
  
  // Structure to hold the complete snake
  struct Snake{
    int size=5; // Variable to hold the size of the snake
    int score=0; // Variable to hold the score
    BodyPart body[99]; // Variable to hold all the bodyparts, 0 being the head and the last the tail.

    int is_initialized=0; // Variable to check if the snake is initialized 0 for not 1 for yes 
  }sSnake;
  
  // Structure to hold the piece of food in the field
  struct Food{
    int does_exist=0; // If the piece of cake exists
    
    int cordX;// Coordinates of the piece of cake
    int cordY;
  }sPieceofcake;
  
  
  // This function goes down the main list of the file
  int update_all(enum input_type keypressed);
  
  // This function moves the snake into a new direction and updates all the parts of the snake
  void moveSnake(input_type key);
  // This function checks the hitdetection if the snake hit an apple (update the whole snake) or a wall
  int hitDetect();
  // This function checks if the fruit is still present and otherwise randomnizes its position and replaces it
  void spawnFood();
  
  // Subroutine for the movesnake function, this makes a new head and cycles the whole snake
  void refreshSnake();